| Conditions | 2 |
| Total Lines | 16 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { QueryHandler } from '@nestjs/cqrs'; |
||
| 13 | |||
| 14 | public async execute(query: GetSchoolVouchersQuery): Promise<SchoolUserView[]> { |
||
| 15 | const schoolUserViews: SchoolUserView[] = []; |
||
| 16 | const vouchers = await this.voucherRepository.findBySchool(query.schoolId); |
||
| 17 | |||
| 18 | for (const voucher of vouchers) { |
||
| 19 | schoolUserViews.push( |
||
| 20 | new SchoolUserView( |
||
| 21 | voucher.getId(), |
||
| 22 | voucher.getEmail(), |
||
| 23 | 'voucher' |
||
| 24 | ) |
||
| 25 | ); |
||
| 26 | } |
||
| 27 | |||
| 28 | return schoolUserViews; |
||
| 29 | } |
||
| 31 |